/**
 * 
 */
package wangjg.game.widget;

import wangjg.game.layer.Graphics;
import wangjg.game.layout.Box;
import wangjg.game.layout.PercentProperty;

/**
 * @author wangjg
 *
 */
public abstract class Widget implements Box {
	private static int idSeq = 0;
	protected int id = idSeq++;
	protected PercentProperty pp = new PercentProperty();
	
	public Widget() {
		
	}
	
	public Widget(float widthPercent, float heightPercent) {
		this(widthPercent, heightPercent, 0);
	}
	
	public Widget(float widthPercent, float heightPercent, int spacing) {
		this.id = idSeq++;
		pp.setWidthPercent(widthPercent);
		pp.setHeightPercent(heightPercent);
		pp.setAbsSpacing(spacing);
	}
	
	public PercentProperty getPercentProperty() {
		return pp;
	}
	
	public int getVisible() {
		return pp.getVisible();
	}
	
	public void setVisible(int visible) {
		pp.setVisible(visible);
	}
	
	public abstract void paint(Graphics g);
}
